<?php
namespace api\xcx\controller;
use think\Cache;
use think\Loader;
use think\Db;
use think\Request;
use think\Controller;
use think\config;
class Ticket extends Base
/**
 *  Ticket.php 优惠券控制器
 *
 * @copyright			(C) 2014-2018 ShengTeng
 * @lastmodify			2018-05-21
 */

{
   /**
 * @api {POST} Ticket/tickets 请求优惠券
 * @apiVersion 1.0.0
 * @apiGroup 优惠券
 *
 * @apiParam {Int} type 券类型,1会员券,2门店券,不传返回所有券
 *
 * @apiSuccess {Int} code 返回码
 * @apiSuccess {String} message  提示信息
 * @apiSuccess {Object} data  返回数据
 *
 * @apiSuccessExample {json} Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *          "code":0,
 *          "message":"",
 *          "data":{
 *              introduce 券介绍
 *              left_title 左边标题
 *              title 券标题
 *              remark 券备注
 *          }
 *      }
 */
   public function tickets(Request $request){
        $params=$request->param();
        $type = "";
        $type = $params['type'];
        $ticket = Model('Ticket');
        $res = $ticket->sel_ticket($type);
        if($res){
            return json(returnAjax($res));
        }else{
            return json(returnAjax('','查询数据失败','-1'));
        }
   }
}
